<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import=" com.sunny.core.bean.*" %>
<%
	Integer pageSize = (Integer)request.getAttribute("pageSize");
	Integer pageNum = (Integer)request.getAttribute("pageNum");
    Long total = (Long)request.getAttribute("total");
	String searchType = (String)request.getAttribute("searchType")==null?"1":(String)request.getAttribute("searchType");
	String searchValue = (String)request.getAttribute("searchValue")==null?"":(String)request.getAttribute("searchValue");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<%@include file="/public/head.jspf"%>
		<!-- 新 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="${dailySupport}/css/bootstrap.min.css">
		<link rel="stylesheet" href="${dailySupport}/css/public/paging/paging.css">
		<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
		<script src="${dailySupport}/js/jquery.min.js"></script>
		<script src="${dailySupport}/js/public/paging/page.js"></script>
		<script src="${dailySupport}/js/com/sunny/core/policy/policy_info_list.js"></script>
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="${dailySupport}/js/bootstrap.min.js"></script>
<script type="text/javascript">
	$(function(){
		$("#sel").click(function(){
			 var com=$("#con").val();
			 if("1"==com){
			 	$("#context").attr("name","realName");
			 }else if("2"==com){
			 	$("#context").attr("name","nickName");
			 }
			$("#con_from").submit();
		});
		
		//初始化分页插件
		$(".tcdPageCode").createPage({
			pageCount: Math.ceil(<%=total%>/<%=pageSize%>),
			current: <%=pageNum%>,
			backFn: function(p) {
				$("#pageNum").val(p);
				$("#con_from").submit();
			}
		});
	})
</script>
	</head>
      
	<body>
		<div style="padding: 0px; margin: 0px;">
			<ul class="breadcrumb" style="margin: 0px;">
				<li>
					<a href="#">系统管理</a>
				</li>
				<li>
					保单管理
				</li>
			</ul>
		</div>
		<div class="row alert alert-info" style="margin: 0px; padding: 3px;">
			<form action="${dailySupport}/policyInfo/query.do" method="post" id="con_from" class="form-horizontal">
				<div class="col-sm-1">
					条件:
				</div>
				<div class="col-sm-3">
					<select id="con" class="form-control  input-sm" name="searchType">
						<option value="policyCode" <% if(searchType.equals("policyCode")){%>selected="selected"<%}%>>
							保单号
						</option>
						<option value="holderName" <% if(searchType.equals("holderName")){%>selected="selected"<%}%>>
							投保人姓名
						</option>
					</select>
				</div>
				<div class="col-sm-3">
					<input type="text" id=searchText class="form-control input-sm" name="searchValue" value="${searchValue}"/>
				</div>
				<input type="button" id="sel" class="btn btn-danger" value="查询"/>
				<input type="button" class="btn btn-success" value="添加"
					onClick="javascript:window.location='${dailySupport}/policy/toAdd.do'" /> 
				<input type="button" class="btn btn-warning" value="导入"
					onClick="javascript:window.location='${dailySupport}/policyInfo/readExcelWriteToDB.do'" /> 
				<input type="hidden" id="pageNum" name="pageNum" value="1"/>
			</form>
		</div>
		<div class="row" style="padding: 15px; padding-top: 0px;">
			<table class="table  table-condensed table-striped">
				<tr>
					<th>
						序号
					</th>
					<th>
						保单号
					</th>
					<th>
						生效日期
					</th>
					<th>
						交费期间
					</th>
					<th>
						保险期间
					</th>
					<th>
						投保人姓名
					</th>
					<th>
						被保人姓名
					</th>
					<th>
						险种名称
					</th>
					<th>
						应缴保费
					</th>
					<th>
						投保人电话
					</th>
					<th>操作</th>					
				</tr>
				<c:forEach items="${policyInfoList}" var="s" varStatus="status">
				<tr>
					<td>
						${(pageNum-1)*pageSize + status.index + 1}
					</td>
					<td>
						${s.policyCode}
					</td>
					<td>
						${s.effectiveDate}
					</td>
					<td>
						${s.paymentPeriod}
					</td>
					<td>
						${s.insurancePeriod}
					</td>
					<td>
						${s.holderName}
					</td>
					<td>
						${s.insuredName}
					</td>
					<td>
						${s.insuranceName}
					</td>
					<td>
						${s.premiumPayable}
					</td>
					<td>
						${s.holderPhoneNum}
					</td>
					<td>
						<a href="${dailySupport}/policyInfo/toDetail.do?policyInfoPid=${s.policyInfoPid}">查看</a>
						<a href="${dailySupport}/policyInfo/toEdit.do?policyInfoPid=${s.policyInfoPid}">修改</a>
						<a href="javascript:deletePolicyInfo('${s.policyInfoPid}')">删除</a>
					</td>
				</tr>
				</c:forEach>
			</table>
		</div>
		<div id="end">
			<!--分页插件begin-->
			<div class="tcdPageCode"></div>
			<!--分页插件end-->
		</div>
	</body>
</html>
